import json

from rpc.aikafka.kafka_kit_json import Kafka_consumer


def rec():
    # 10.20.2.19
    # 10.20.5.3
    # consumer = Kafka_consumer(bootstrap_servers='10.20.5.3', kafkatopic='ehl',
    #                           groupid='test4')
    consumer = Kafka_consumer(bootstrap_servers='10.20.2.19', kafkatopic='accidentRecognize',
                              auto_offset_reset='earliest',groupid='test4')
    # auto_offset_reset = 'earliest',
    data = consumer.read_df(False)
    for message in data:
        data = message.decode()
        # print(data)
        message = json.loads(data)
        print(message)

if __name__ == '__main__':
    rec()